ApplyTableIndex

申请创建表索引

申请创建表索引,如果有其他表操作申请单未处理,会报冲突

请求地址

POST
http://OmsAddress/app/newoms.php/webservice/business/table/apply-table-index?cmd=10022&ip-type=webservicerest&access-token=AccessTokenVal

POST请求参数说明

参数 格式 是否必填 说明
app_id 整型 业务ID
zone_id 字符串
table_name 字符串
key_index_fields 数组 选择哪个key字段作为索引
value_index_fields 数组 选择哪个value字段作为索引
memo 备注 apply by webservice

Data参数

使用json格式表示记录相关信息,示例如下:

{
    "app_id": 2,
    "zone_id": 4,
    "table_name": "T_CHESS_COMMENT",
    "key_index_fields": [
        "chess_id"
    ],
    "value_index_fields": [
        "thumb_num"
    ],
    "memo": "apply by webservice"
}

返回语法

返回参数说明

需要关注的参数是 apply,info,id, 在审核的时候需要用到

请求示例

通过 curl 方法发起请求

命令中的参数请参考本页中的“POST请求参数说明”,access-token的获取方法详见:获取access-token

curl -H "Content-type: application/json" -X "POST" -d '{
    "app_id": 2,
    "zone_id": 4,
    "table_name": "T_CHESS_COMMENT",
    "key_index_fields": [
        "chess_id"
    ],
    "value_index_fields": [
        "thumb_num"
    ],
    "memo": "apply by webservice"
}' http://omsaddress/app/newoms.php/webservice/business/table/apply-table-index?cmd=10022&ip-type=webservicerest&access-token=<access-token>

返回示例

成功返回示例

http请求的Status=200

{
    "apply": {
        "ret": 0,
        "info": {
            "dba": "tcaplus;peterwong",
            "set_id": 1,
            "app_id": 2,
            "app_name": "test_app",
            "zone_list": "4",
            "table_name": "T_CHESS_COMMENT",
            "table_type": 0,
            "apply_type": 14,
            "user": "peterwong",
            "write_time": "2020-10-16 14:21:56",
            "memo": "apply by webservice",
            "job_id": 21,
            "key_struct": "[\"chess_id\"]",
            "value_struct": "[\"thumb_num\"]",
            "dm_ratio": 5,
            "table_maxnum": 0,
            "calc_resource_type": 1,
            "attention_man": "",
            "kelly_id": 0,
            "resource_ratio": 1,
            "sort_field_num": 0,
            "sort_rule": 0,
            "data_protocol_type": "TBD",
            "id": 117
        },
        "msg": ""
    }
}

错误返回

http请求的Status!=200

{
    "name": "Unauthorized",
    "message": "You are requesting with an invalid credential.",
    "code": 0,
    "status": 401,
    "type": "yii\\web UnauthorizedHttpException"
}
{
    "source_ip": "ip:10.29.89.51 not in whitelist"
}

results matching ""

    No results matching ""